package com.gdut.huayan.utils;

import com.github.pagehelper.PageInfo;

import java.util.List;

public class PageInfoUtils<E,T>{

    public PageInfo<T> copy(PageInfo<E> oldPage, List<T> newList){
        PageInfo<T> result = new PageInfo<>(newList);
        copy(oldPage,result);
        return result;
    }

    public void copy  (PageInfo<E> oldPage,PageInfo<T> newPage){
        newPage.setTotal(oldPage.getTotal());
        newPage.setPageSize(oldPage.getPageSize());
        newPage.setPageNum(oldPage.getPageNum());
        newPage.setSize(oldPage.getSize());
        newPage.setStartRow(oldPage.getStartRow());
        newPage.setEndRow(oldPage.getEndRow());
        newPage.setPages(oldPage.getPages());
        newPage.setPrePage(oldPage.getPrePage());
        newPage.setNextPage(oldPage.getNextPage());
        newPage.setIsFirstPage(oldPage.isIsFirstPage());
        newPage.setIsLastPage(oldPage.isIsLastPage());
        newPage.setHasPreviousPage(oldPage.isHasPreviousPage());
        newPage.setHasNextPage(oldPage.isHasNextPage());
        newPage.setNavigatePages(oldPage.getNavigatePages());
        newPage.setNavigatepageNums(oldPage.getNavigatepageNums());
        newPage.setNavigateFirstPage(oldPage.getNavigateFirstPage());
        newPage.setNavigateLastPage(oldPage.getNavigateLastPage());
    }
}
